import { RedisClient as Client } from 'redis';
import { Lock } from 'redlock';

export * from './poll';
export * from './redlock';

export interface RedisClient extends Client {

  release: (cb?: Function) => Promise<any>;

  getLock: (resource: string, ttl?: number) => Lock | null;

  _set(key: string, value: string): Promise<'OK' | undefined>;

  _set(key: string, value: string, flag: string): Promise<'OK' | undefined>;

  _set(key: string, value: string, mode: string, duration: number): Promise<'OK' | undefined>;

  _set(key: string, value: string, mode: string, duration: number, flag: string): Promise<'OK' | undefined>;

  _set(key: string, value: string): Promise<'OK' | undefined>;

  _set(key: string, value: string, flag: string): Promise<'OK' | undefined>;

  _set(key: string, value: string, mode: string, duration: number): Promise<'OK' | undefined>;

  _set(key: string, value: string, mode: string, duration: number, flag: string,): Promise<'OK' | undefined>;

  _hset: (key: string, field: string, value: string) => Promise<'OK' | undefined>,

  _hvals: (key: string,) => Promise<string[]>,

  _hget: (key: string, field: string) => Promise<string>,
}
